<!--
 * Description: CBOM报价确认
 * Company: 联宝（合肥）电子科技有限公司
 * Author: Qiuxue.Wu
 * Date: 2020/10/15 15:26
-->

<template>
  <BaseWrap>
    <CbomQuoteConfirmBaseData />
    <CbomQuoteList v-if="isQuote" :rowData="currentRowData" @cancel="isQuote = false" />
    <!--编辑-->
    <BaseDialog
      v-if="editDialogVisible"
      title="报价"
      :visible.sync="editDialogVisible"
      width="800px"
    >
      <CbomQuoteEdit :rowData="currentQuoteRowData" @cancel="editDialogVisible = false" />
    </BaseDialog>
  </BaseWrap>
</template>
<script>
import CbomQuoteConfirmBaseData from './components/CbomQuoteConfirmBaseData'
import CbomQuoteList from './components/CbomQuoteList'
import CbomQuoteEdit from './components/CbomQuoteEdit'
export default {
  name: 'CbomQuoteConfirm',

  components: { CbomQuoteConfirmBaseData, CbomQuoteList, CbomQuoteEdit },

  data() {
    return {
      // 是否进行报价
      isQuote: false,
      // 当前行数据
      currentRowData: {},
      // 当前报价详情行数据
      currentQuoteRowData: {},

      editDialogVisible: false
    }
  },

  created() {
    /** 报价数据查看 */
    this.$bus.$on('cbom-quote-list', rowData => {
      this.currentRowData = rowData
      this.isQuote = true
    })

    /** 报价数据修改 */
    this.$bus.$on('cbom-quote-edit', rowData => {
      this.currentQuoteRowData = rowData
      this.editDialogVisible = true
    })
  },

  beforeCreate() {
    /** 报价数据查看 */
    this.$bus.$off('cbom-quote-list')
    /** 报价数据修改 */
    this.$bus.$off('cbom-quote-edit')
  }
}
</script>
